package com.wcfsy.wechat.wx.um.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.wcfsy.wechat.wx.pagination.IPage;
import com.wcfsy.wechat.wx.pagination.impl.Page;
import com.wcfsy.wechat.wx.um.dao.IRoleDao;
import com.wcfsy.wechat.wx.um.entity.Permission;
import com.wcfsy.wechat.wx.um.entity.Role;
import com.wcfsy.wechat.wx.um.service.IRoleConService;

@Service
public class RoleConServiceImpl implements IRoleConService {
	@Resource
	private IRoleDao roleDao;

	public void add(Role paramRole) {
		// TODO Auto-generated method stub

	}

	public void deleteById(long paramLong) throws Exception {
		// TODO Auto-generated method stub

	}

	public void update(Role role) {
		try {
			roleDao.update(role);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public Role getById(long id) {
		return roleDao.getById(id);
	}

	public Role getByRoleCode(String paramString) {
		// TODO Auto-generated method stub
		return null;
	}

	public IPage<Role> findRoleByPage(Role paramRole, int index, int size) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("role", paramRole);
		paramMap.put("index", index);
		paramMap.put("size", size);
		IPage<Role> page = new Page<Role>(roleDao.findByParam(paramMap),
				roleDao.count(paramMap), index, size);
		return page;
	}

	public List<Role> findAll(String paramString, Long paramLong) {
		// TODO Auto-generated method stub
		return null;
	}

	public IPage<Role> findAll(int paramInt1, int paramInt2) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Permission> getPermissionListByRoleId(long roleId) {
		return roleDao.getPermissionListByRoleId(roleId);
	}

	public String getPermisNameListByRoleId(long paramLong) {
		// TODO Auto-generated method stub
		return null;
	}

	public void configPermis(long paramLong1, long paramLong2) {
		// TODO Auto-generated method stub

	}

	public void configPermisList(long roleId, List<Long> permissionIdList) {
		roleDao.deleteRolePermisByRoleId(roleId);
		for (int i = 0; i < permissionIdList.size(); i++) {
			Map<String,Long> paramMap = new HashMap<String, Long>();
			paramMap.put("roleId", roleId);
			paramMap.put("permissionId", permissionIdList.get(i));
			roleDao.addRolePermis(paramMap);
		}
	}

	public void configPermisList(Map<String, Object> paramMap) {
		// TODO Auto-generated method stub

	}

	public boolean checkQuote(long paramLong) {
		// TODO Auto-generated method stub
		return false;
	}

	public List<Role> getAllNoRole(Map<String, Object> paramMap) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Role> queryRoleListByCardId(long paramLong) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<String> queryPerm(List<Long> paramList) {
		// TODO Auto-generated method stub
		return null;
	}

	public void configDefaultRole(Long paramLong1, Long paramLong2,
			Long paramLong3) {
		// TODO Auto-generated method stub

	}

	public List<Role> queryRoleListByUserId(Long paramLong) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Role> queryNoRoleListByUserId(Long paramLong1,
			String paramString, Long paramLong2) {
		// TODO Auto-generated method stub
		return null;
	}

}
